								<div id="side" <?php if (is_single()) echo 'style="margin-top:28px;"';?>>
                <?php $aboutpage = get_page_by_title(get_option('centita_about_pid'));?>
                <?php $servicespage = get_page_by_title(get_option('centita_services_pid'));?>
                <?php $contactpid = get_page_by_title(get_option('centita_contact_pid'));?>
                
								<?php
                		$children=wp_list_pages( 'echo=0&child_of=' . $post->ID . '&title_li=' );
                		if ($children) {
                			$parent = $post->ID;
                		}else{
                			$parent = $post->post_parent;
                			if(!$parent){
                				$parent = $post->ID;
                			}
                		}              
                    $children = wp_list_pages("title_li=&child_of=".$parent."&echo=0&depth=1&menu_order=sort_column");
                    $parent_title = get_the_title($parent);
                  ?>  
                  <?php if ($children) { ?>
                   	 <div class="sidebox-top"></div>
                     <div class="sidebox">
                     <h3><?php echo $parent_title;?></h3>              
                     <ul class="about-list">
                     	<?php echo $children;?>   
                     </div>                                   
                  <?php 
                    }
                  ?>
                  
                  <?php if (is_home() || is_page_template('homepage-nivo.php')) { ?>
                  <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Homepage Sidebar')) : endif; ?>
                  <?php } else if (is_page_template('blog-template.php') || is_category() || is_search() || is_404()) {
                    if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Blog Sidebar')) : 
                      if (function_exists('dynamic_sidebar') && dynamic_sidebar('General Sidebar')) : endif;
                    endif;
                  } else if (is_page($aboutpage->ID)) {
                    if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('About Page')) :  
                      if (function_exists('dynamic_sidebar') && dynamic_sidebar('General Sidebar')) : endif;
                    endif;
                  } else if (is_page($servicespage->ID)) {
                    if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Services Page')) :  
                      if (function_exists('dynamic_sidebar') && dynamic_sidebar('General Sidebar')) : endif;
                    endif;              
                  } else if (is_single()) {
                    if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Single Post')) :  
                      if (function_exists('dynamic_sidebar') && dynamic_sidebar('General Sidebar')) : endif;
                    endif;
                  } else if (is_page($contactpid->ID)) { 
                    if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Contact Sidebar')) : 
                      if (function_exists('dynamic_sidebar') && dynamic_sidebar('General Sidebar')) : endif;
                    endif; 
                  } else {
                    if (function_exists('dynamic_sidebar') && !dynamic_sidebar('General Sidebar')) : endif;
                  }
                ?>           
								</div><!-- end of side -->